<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template_layout_lrt.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<style>
.ui-dialog {
	top: 100px !important;
}

.col-md-9 .box-header {
	height: 0px;
	padding: 0px;
	margin: 0px;
}

.box-body {
	padding-top: 1px !important;
}

.col-md-9 .slimScrollDiv {
	height: 750px !important;
}
</style>
	</ui:define>
	<ui:define name="top-box-tools">
		<h:form id="btnForm">
			<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
				<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
				<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
			</p:confirmDialog>
			<p:growl id="msgs" showDetail="true" />
			<p:toolbar id="btnBar"
				rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_sq') or
					s:hasPermission(session,'xtsz_xtqx_qxgl_jssz')}">
				<f:facet name="left">
					<p:commandButton icon="fa fa-hand-paper-o" value="功能授权" id="savebtn"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_sq') &amp;&amp; 
						organizationPermissionController4Nw.currentSelectRole == null &amp;&amp; organizationPermissionController4Nw.selectedNode != null}"
						update="grantPermissionForm:treeTable grantPermissionDialog"
						actionListener="#{organizationPermissionController4Nw.preGrantPermission()}"
						style="font-weight:normal;margin-left:3px" oncomplete="PF('grantPermissionDialog').show()" />
					<p:commandButton icon="fa fa-hand-paper-o" value="角色授权" id="roleGrantBtn"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_jsgl_sq') &amp;&amp; organizationPermissionController4Nw.currentSelectRole != null}"
						update="grantPermissionForm:treeTable grantPermissionDialog"
						actionListener="#{organizationPermissionController4Nw.preGrantPermission()}"
						style="font-weight:normal;margin-left:3px" oncomplete="PF('grantPermissionDialog').show()" />
					<p:commandButton icon="fa fa-group" value="角色设置" id="roleedit"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_jssz') &amp;&amp; 
						organizationPermissionController4Nw.selectedNode != null}"
						update="grantPermissionForm:treeTable msgs"
						actionListener="#{organizationPermissionController4Nw.openGrantRoleDialog()}"
						style="font-weight:normal;margin-left:3px">
						<p:ajax event="dialogReturn" listener="#{organizationPermissionController4Nw.dialogCallBack}"
							update=":rightForm leftForm:tree msgs" />
					</p:commandButton>
					<p:commandButton icon="fa fa-hand-paper-o" value="变电站设置"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bdzsz') &amp;&amp; 
						organizationPermissionController4Nw.currentDept != null}"
						update="substationSetDialog" style="font-weight:normal;margin-left:3px"
						actionListener="#{organizationPermissionController4Nw.preSettingSubstation()}"
						oncomplete="PF('substationSetDialog').show()" />
					<!-- 角色的功能按钮 -->
					<!-- <span class="ui-separator"> <span
						class="ui-icon ui-icon-grip-dotted-vertical" />
					</span> -->
					<p:commandButton value="新建角色" id="newBtn" icon="ui-icon-document"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_xj') &amp;&amp; 
						organizationPermissionController4Nw.selectedNode == null}"
						actionListener="#{organizationPermissionController4Nw.preCreateRole}"
						update=":roleForm:rolepg roleTreeForm:roleTree" style="margin-left: 3px;"
						oncomplete="PF('newDialog').show()" />
					<p:commandButton value="编辑角色" id="editBtn" icon="ui-icon-pencil"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bj') &amp;&amp; 
						organizationPermissionController4Nw.currentSelectRole != null}"
						update=":roleForm:rolepg" oncomplete="PF('newDialog').show()" style="margin-left: 3px;" />
					<p:commandButton value="删除角色" id="deleteBtn" icon="ui-icon-trash"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_sc') &amp;&amp; 
						organizationPermissionController4Nw.currentSelectRole != null}"
						actionListener="#{organizationPermissionController4Nw.deleteRole}"
						update=":roleTreeForm:roleTree btnBar msgs :rightForm" style="margin-left: 3px;">
						<p:confirm header="提示" message="您确定要删除该角色吗？删除后该角色将不可用！" icon="ui-icon-alert" />
					</p:commandButton>
					<!-- 组织机构相关功能按钮 -->
					<!-- <span class="ui-separator"> <span
						class="ui-icon ui-icon-grip-dotted-vertical" />
					</span> -->
					<p:commandButton icon="fa fa-plus" value="新建部门" style="margin-left: 3px;"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_zzjg_xjbm') &amp;&amp; 
						organizationPermissionController4Nw.currentDept!=null}"
						update="cgform :cgform:deptNo" oncomplete="PF('createDeptDialog').show()"
						actionListener="#{organizationPermissionController4Nw.preCreateDept()}" />
					<p:commandButton icon="fa fa-user-plus" value="新增员工" style="margin-left: 3px;"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_zzjg_xzyg') &amp;&amp; 
						organizationPermissionController4Nw.currentDept!=null}"
						update=":crform:personnelInfopg :crform:createPersonToBar :crform:perNo :rightForm"
						oncomplete="PF('createUserDialog').show()"
						actionListener="#{organizationPermissionController4Nw.preCreatePerson()}" />
					<p:commandButton icon="fa fa-pencil" value="编辑部门" style="margin-left: 3px;"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_zzjg_bjbm') &amp;&amp; 
						organizationPermissionController4Nw.currentDept!=null}"
						update="cgform" oncomplete="PF('createDeptDialog').show()"
						actionListener="#{organizationPermissionController4Nw.preEditDept()}" />
					<p:commandButton icon="fa fa-pencil" value="编辑员工" process="@this" style="margin-left: 3px;"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_zzjg_bjyg') &amp;&amp; 
						organizationPermissionController4Nw.currentPerson!=null}"
						update="editform:editInfopg editform:editPersonToBar changeDeptform:deptTree"
						actionListener="#{organizationPermissionController4Nw.updateDeptTree}"
						oncomplete="PF('editUserDialog').show()" />
					<p:commandButton icon="fa fa-trash-o" value="删除" style="margin-left: 3px;"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_zzjg_sc') &amp;&amp; 
						(organizationPermissionController4Nw.currentDept!=null || organizationPermissionController4Nw.currentPerson!=null)}"
						update=":leftForm:tree :rightForm :btnForm:btnBar :btnForm:msgs"
						actionListener="#{organizationPermissionController4Nw.delete()}">
						<p:confirm header="提示" message="确定删除选中的记录吗?" icon="ui-icon-alert" />
					</p:commandButton>
				</f:facet>
				<f:facet name="right">
					<!-- 快捷键功能按钮 -->
					<!-- <span class="ui-separator"> <span
						class="ui-icon ui-icon-grip-dotted-vertical" />
					</span> -->
					<p:commandButton value="重置权限" id="oneKeySet" icon="ui-icon-refresh"
						rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_yjzz')}"
						actionListener="#{organizationPermissionController4Nw.oneKeySet}" update="rightForm msgs"
						style="margin-left: 3px;">
						<p:confirm header="提示" message="您确定要清除权限缓存吗？" icon="ui-icon-alert" />
					</p:commandButton>
				</f:facet>
			</p:toolbar>
		</h:form>
	</ui:define>
	<ui:define name="left-box-title">
		&nbsp;组织机构
	</ui:define>
	<ui:define name="left-box-body">
		<h:form id="leftForm">
			<p:tree value="#{organizationPermissionController4Nw.root}" var="node" dynamic="true" id="tree"
				widgetVar="tree" animate="true" selectionMode="multiple"
				selection="#{organizationPermissionController4Nw.selectedNodes}" style="border:0">
				<p:ajax event="expand" update="tree :btnForm:savebtn"
					listener="#{organizationPermissionController4Nw.onNodeExpand}" />
				<p:ajax event="select"
					update=":btnForm:btnBar :roleTreeForm:roleTree :rightForm :btnForm:savebtn"
					listener="#{organizationPermissionController4Nw.onNodeSelect}" />
				<p:ajax event="unselect" update=":btnForm:btnBar :btnForm:btnBar :rightForm :btnForm:savebtn"
					listener="#{organizationPermissionController4Nw.onNodeUnSelect}" />
				<p:treeNode type="dept" icon="fa fa-home">
					<h:outputText value="#{node}" />
				</p:treeNode>
				<p:treeNode type="personnel" icon="fa fa-user">
					<h:outputText value="#{node}" />
				</p:treeNode>
				<p:treeNode type="personnelr" icon="fa  fa-user">
					<h:outputText value="#{node}" />
				</p:treeNode>
			</p:tree>
		</h:form>
		<h:form id="roleTreeForm">
			<p:tree value="#{organizationPermissionController4Nw.roleRoot}" var="node" dynamic="true"
				id="roleTree" widgetVar="roleTree" animate="true" selectionMode="multiple"
				selection="#{organizationPermissionController4Nw.roleSelectedNodes}" style="border:0">
				<p:ajax event="select" update=":rightForm :btnForm:btnBar :leftForm:tree"
					listener="#{organizationPermissionController4Nw.onRoleNodeSelect}" />
				<p:ajax event="unselect" update=":rightForm :btnForm:btnBar"
					listener="#{organizationPermissionController4Nw.onRoleNodeUnSelect}" />
				<p:treeNode type="root" icon="fa fa-home">
					<h:outputText value="#{node}" />
				</p:treeNode>
				<p:treeNode icon="fa fa-user-circle-o">
					<h:outputText value="#{node}" />
				</p:treeNode>
			</p:tree>
		</h:form>
	</ui:define>
	<ui:define name="right-box-body">
		<h:form id="rightForm">
			<p:tabView id="tables">
				<p:tab title="所属权限" id="roles">
					<p:treeTable id="treeTable" widgetVar="treeTable" emptyMessage="无数据"
						value="#{organizationPermissionController4Nw.funcRoot}" var="fun">
						<p:column headerText="名称" style="width:30%">
							<h:outputText value="#{fun.function.name} " />
						</p:column>

						<p:column headerText="权限" style="text-align:center;width:15%">
							<h:outputText rendered="#{fun.permission=='DENY'}" style="color:red" value="拒绝" />
							<h:outputText rendered="#{fun.permission=='ALLOW'}" style="color:green" value="允许" />
						</p:column>

						<p:column headerText="类型" style="text-align:center;width:15%">
							<h:outputText styleClass="fa fa-bars" rendered="#{fun.function.type.equals('menu')}"
								value=" 菜单" style="color:#006400" />
							<h:outputText styleClass="fa fa-home" rendered="#{fun.function.type.equals('page')}"
								value=" 页面" style="color:#433" />
							<h:outputText styleClass="fa fa-dot-circle-o"
								rendered="#{fun.function.type.equals('pagemenu')}" value="  页内菜单" style="color:#CD2990" />
							<h:outputText styleClass="fa fa-wrench" rendered="#{fun.function.type.equals('operation')}"
								value="  操作" style="color:blue" />
						</p:column>
					</p:treeTable>
				</p:tab>
				<p:tab title="人员列表" rendered="#{organizationPermissionController4Nw.currentSelectRole != null}">
					<p:treeTable scrollable="true" id="rolePersonTable" widgetVar="rolePersonTable"
						value="#{organizationPermissionController4Nw.rolePersonRoot}" var="r" emptyMessage="暂无数据">
						<p:column headerText="名称" style="width:30%">
							<h:outputText value="#{r.name} " />
						</p:column>
						<p:column headerText="电话" style="width:35%">
							<h:outputText value="#{r.telphone}" />
						</p:column>
						<p:column headerText="状态" style="width:35%">
							<h:outputText rendered="#{r.status.equals('正常')}" style="color:#2399e5" value="#{r.status}" />
							<h:outputText rendered="#{r.status.equals('锁定')}" style="color:red" value="#{r.status}" />
						</p:column>
					</p:treeTable>
				</p:tab>
				<p:tab title="所属角色"
					rendered="#{organizationPermissionController4Nw.selectedNode.type == 'personnel' ||  organizationPermissionController4Nw.selectedNode.type == 'personnelr'}">
					<p:dataTable id="personRoleTable" var="r"
						value="#{organizationPermissionController4Nw.personRoles}" style="text-align:center"
						emptyMessage="暂无数据">
						<p:column headerText="角色名称">
							<p:outputLabel value="#{r.name}" />
						</p:column>
						<p:column headerText="角色描述">
							<p:outputLabel value="#{r.description}" />
						</p:column>
					</p:dataTable>
				</p:tab>
				<!-- 变电站tab -->
				<p:tab title="变电站" rendered="#{organizationPermissionController4Nw.currentDept != null}">
					<p:treeTable id="orgSubstationTreeTable" scrollable="true" emptyMessage="无数据"
						widgetVar="orgSubstationTreeTable"
						value="#{organizationPermissionController4Nw.orgSubstationRoot}" var="orgSub">
						<p:ajax event="expand" update="orgSubstationTreeTable"
							listener="#{organizationPermissionController4Nw.onStationNodeExpand}" />
						<p:column headerText="名称" style="width:30%">
							<h:outputText value="#{orgSub.name} " />
						</p:column>
						<p:column headerText="权限" style="text-align:center;width:25%">
							<h:outputText rendered="#{orgSub.permission=='true'}" style="color:green" value="允许" />
						</p:column>
					</p:treeTable>
				</p:tab>
				<!-- 组织机构tab -->
				<p:tab title="员工信息列表"
					rendered="#{organizationPermissionController4Nw.currentDept != null || organizationPermissionController4Nw.currentPerson != null}">
					<p:dataTable var="pebCurrent" id="plist" value="#{organizationPermissionController4Nw.personnels}"
						rowKey="#{pebCurrent.id}" widgetVar="plist" emptyMessage="无记录" style="text-align:center">
						<p:column headerText="用户名" style="width:20%">
							<h:outputText value="#{pebCurrent.code}" />
						</p:column>
						<p:column headerText="姓名" style="width:10%">
							<h:outputText value="#{pebCurrent.name}" />
						</p:column>
						<p:column headerText="状态" style="width:10%">
							<h:outputText rendered="#{pebCurrent.locked}" style="color:red" value="锁定" />
							<h:outputText rendered="#{!pebCurrent.locked}" value="正常" />
						</p:column>
						<p:column headerText="电话" style="width:15%">
							<h:outputText value="#{pebCurrent.telephone}" />
						</p:column>
						<p:column headerText="地址" style="width:20%">
							<h:outputText value="#{pebCurrent.address}" />
						</p:column>
						<p:column headerText="操作" style="width:25%">
							<p:commandButton icon="fa fa-pencil" value="密码重置"
								rendered="#{s:hasPermission(session,'xtsz_xtqx_zzjg_mmzz')}"
								actionListener="#{organizationPermissionController4Nw.preResetPassword(pebCurrent.code)}"
								oncomplete="PF('resetPasswordDialog').show()" update="resetPwdForm:resetPwdpg" />
							<p:commandButton update="plist"
								actionListener="#{organizationPermissionController4Nw.unLockPerson(pebCurrent)}"
								rendered="#{pebCurrent.locked}" icon="fa fa-unlock" value="解锁">
								<p:confirm header="提示" message="确定解除当前用户吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
				</p:tab>
			</p:tabView>
		</h:form>

		<p:dialog widgetVar="grantPermissionDialog" id="grantPermissionDialog" resizable="false"
			header="#{organizationPermissionController4Nw.grantPerTitle}" modal="true" width="1200" height="700">
			<p:outputLabel value="提示:选择多个则只给最后一个对象授权" style="color:red"
				rendered="#{organizationPermissionController4Nw.showNotice()}" />
			<h:form id="grantPermissionForm">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" process="@this"
							actionListener="#{organizationPermissionController4Nw.save()}" update=":rightForm btnForm:msgs"
							oncomplete="PF('grantPermissionDialog').hide()" styleClass="margin-left:10px" />
					</f:facet>
				</p:toolbar>
				<p:treeTable scrollable="true" scrollHeight="500" style="margin-top:6px" id="treeTable"
					widgetVar="treeTable" value="#{organizationPermissionController4Nw.grantRoot}" var="fun">
					<p:ajax event="expand" listener="#{organizationPermissionController4Nw.onFunNodeExpand}" />
					<p:ajax event="collapse" listener="#{organizationPermissionController4Nw.onFunNodeCollapse}" />
					<p:column headerText="名称" style="width:30%">
						<h:outputText value="#{fun.function.name} " />
					</p:column>

					<p:column headerText="地址" style="width:35%">
						<h:outputText value="#{fun.function.url}" />
					</p:column>

					<p:column headerText="类型" style="text-align:center;width:10%">
						<h:outputText styleClass="fa fa-home" rendered="#{fun.function.type.equals('page')}"
							value="  页面" style="color:#433" />
						<h:outputText styleClass="fa fa-dot-circle-o"
							rendered="#{fun.function.type.equals('pagemenu')}" value="  页内菜单" style="color:#CD2990" />
						<h:outputText styleClass="fa fa-bars" rendered="#{fun.function.type.equals('menu')}"
							value="  菜单" style="color:#006400" />
						<h:outputText styleClass="fa fa-wrench" rendered="#{fun.function.type.equals('operation')}"
							value="  操作" style="color:blue" />
					</p:column>
					<p:column headerText="权限" value="#{fun.permission}" style="padding:0px;width:25%">
						<p:selectOneRadio widgetVar="#{fun.function.id}"
							rendered="#{!fun.function.type.equals('root') &amp;&amp; !fun.function.type.equals('approot')}"
							value="#{fun.permission}" style="padding:0;margin:0">
							<p:ajax event="click" update="treeTable"
								listener="#{organizationPermissionController4Nw.changeRadio}" />
							<f:selectItem itemLabel="允许" itemValue="ALLOW" />
							<f:selectItem itemLabel="拒绝" itemValue="DENY" />
							<f:selectItem itemLabel="无" itemValue="" />
						</p:selectOneRadio>
					</p:column>
				</p:treeTable>
			</h:form>
		</p:dialog>

		<!-- 变电站设置dialog -->
		<p:dialog widgetVar="substationSetDialog" id="substationSetDialog" resizable="false"
			header="变电站设置" modal="true" width="1200" height="650">
			<h:form id="substationSetForm">
				<p:toolbar>
					<f:facet name="left">
						<p:autoComplete id="startionSearch" dropdown="true" placeholder="变电站首字母查询" scrollHeight="400"
							value="#{organizationPermissionController4Nw.stationSearch}" style="margin-right:10px"
							completeMethod="#{stationDataViewController.complateStation}">
							<p:ajax update="substationSetForm" event="itemSelect"
								listener="#{organizationPermissionController4Nw.searchBySubstation()}" />
						</p:autoComplete>
						<!-- <p:commandButton value="查询" icon="ui-icon-search" 
							rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bdzcx')}" 
							actionListener="#{organizationPermissionController4Nw.searchBySubstation()}"
							update="substationSetForm" /> -->
						<p:commandButton value="重置" icon="ui-icon-refresh"
							rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bdzzz')}"
							actionListener="#{organizationPermissionController4Nw.resetSubstation()}"
							update="startionSearch substationSetForm" />
						<p:commandButton value="保存"
							actionListener="#{organizationPermissionController4Nw.substationSetting()}"
							rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bdzbc')}" update="rightForm btnForm:msgs"
							oncomplete="PF('substationSetDialog').hide()" />
					</f:facet>
					<!-- <f:facet name="right">
						<p:commandButton value="全选" actionListener="#{organizationPermissionController4Nw.substationCheckAll()}" 
							rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bdzqx')}" 
							update="substationTreeTable" />
						<p:commandButton value="反选" actionListener="#{organizationPermissionController4Nw.substationUnCheckAll()}" 
							rendered="#{s:hasPermission(session,'xtsz_xtqx_qxgl_bdzfx')}" 
							update="substationTreeTable" />
					</f:facet> -->
				</p:toolbar>
				<p:remoteCommand name="substationCheckAll" update="substationTreeTable"
					actionListener="#{organizationPermissionController4Nw.substationCheckAll()}" />
				<p:remoteCommand name="substationUnCheckAll" update="substationTreeTable"
					actionListener="#{organizationPermissionController4Nw.substationUnCheckAll()}" />
				<p:treeTable id="substationTreeTable" widgetVar="substationTreeTable" scrollable="true"
					scrollHeight="500" style="margin-top:6px" emptyMessage="无数据"
					value="#{organizationPermissionController4Nw.substationRoot}" var="sub">
					<p:columnGroup type="header">
						<p:row>
							<p:column rowspan="2" headerText="名称" style="width:30%" />
							<p:column>
								<f:facet name="header">
									<p:commandLink onclick="substationCheckAll()" style="color: red;">全选</p:commandLink>
									<p:commandLink onclick="substationUnCheckAll()" style="margin-left: 20px; color: red;">反选</p:commandLink>
									<!-- <p:selectBooleanCheckbox valueChangeListener="#{organizationPermissionController4Nw.substationCheckAll()}" value="#{organizationPermissionController4Nw.value}" itemLabel="全选">
										<p:ajax listener="#{organizationPermissionController4Nw.substationCheckAll()}" />
							        </p:selectBooleanCheckbox> -->
								</f:facet>
							</p:column>
						</p:row>
						<p:row>
							<p:column headerText="权限" />
						</p:row>
					</p:columnGroup>
					<p:column headerText="名称" style="width:30%">
						<h:outputText value="#{sub.name}" />
					</p:column>
					<p:column headerText="权限" value="#{sub.permission}"
						style="padding:0px;width:25%; text-align: center;">
						<!-- <p:selectOneRadio widgetVar="#{sub.id}" value="#{sub.permission}"
							style="padding:0;margin:0">
							<p:ajax event="click" update="substationTreeTable" listener="#{organizationPermissionController4Nw.substationRadio}" />
							<f:selectItem itemLabel="允许" itemValue="ALLOW" />
							<f:selectItem itemLabel="拒绝" itemValue="DENY" />
						</p:selectOneRadio> -->
						<p:selectBooleanCheckbox widgetVar="#{sub.id}" value="#{sub.permission}" itemLabel="允许">
							<p:ajax update="substationTreeTable"
								listener="#{organizationPermissionController4Nw.substationRadio}" />
						</p:selectBooleanCheckbox>
					</p:column>
				</p:treeTable>
			</h:form>
		</p:dialog>

		<p:dialog widgetVar="newDialog" id="newDialog" header="角色信息" modal="true" width="600" height="300">
			<h:form id="roleForm">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk" oncomplete="PF('newDialog').hide()"
							actionListener="#{organizationPermissionController4Nw.saveRole()}"
							update=":roleTreeForm:roleTree :btnForm:btnBar :btnForm:msgs" />
					</f:facet>
				</p:toolbar>
				<p:panelGrid columns="2" id="rolepg" style="margin-top:10px; width:100%;border:0">
					<h:outputText value="角色名称" />
					<p:inputText value="#{organizationPermissionController4Nw.currentSelectRole.name}"
						style="width:100%" />
					<h:outputText value="角色描述" />
					<h:inputTextarea value="#{organizationPermissionController4Nw.currentSelectRole.description}"
						style="width:100%" />
				</p:panelGrid>
			</h:form>
		</p:dialog>
		<!-- 以下是组织机构相关dialog -->
		<p:dialog widgetVar="resetPasswordDialog" id="resetPasswordDialog" header="密码重置" closable="true"
			resizable="false" draggable="false" modal="true" width="600px" height="200px">
			<p:layout style="width:580px;height:180px">
				<p:layoutUnit position="center">
					<h:form id="resetPwdForm">
						<p:toolbar>
							<f:facet name="left">
								<p:commandButton icon="ui-icon-disk" value="保存"
									oncomplete="PF('resetPasswordDialog').hide()"
									actionListener="#{organizationPermissionController4Nw.updatePwd}" update="btnForm:msgs"
									style="margin-left:5px" />
								<p:commandButton icon="ui-icon-cancel" value="取消" style="margin-left:5px"
									onclick="PF('resetPasswordDialog').hide()" />
							</f:facet>
						</p:toolbar>
						<p:panelGrid id="resetPwdpg" columns="2" cellpadding="8" style="width:100%;text-align:center">
							<h:outputText value="新密码:" />
							<p:password id="pwd3" style="width:100%" value="#{organizationPermissionController4Nw.newPwd}"
								feedback="true" inline="true" promptLabel="输入密码" weakLabel="弱" goodLabel="中" strongLabel="强" />
							<h:outputText value="新密码确认:" />
							<p:password id="pwd4" style="width:100%" value="#{organizationPermissionController4Nw.newPwd1}" />
						</p:panelGrid>
					</h:form>
				</p:layoutUnit>
				<p:layoutUnit position="east" header="密码要求" size="40%">
					1、密码的长度不小于8位<br />
					2、密码不能与旧密码相同<br />
					3、密码不能与用户名相同<br /> 
					4、密码至少为字符、数字和符号其中两种组合
				</p:layoutUnit>
			</p:layout>
		</p:dialog>
		<!-- 编辑员工 -->
		<p:dialog widgetVar="editUserDialog" header="编辑员工信息" closable="false" resizable="false"
			draggable="false" modal="true" width="430" height="380">
			<h:form id="editform">
				<p:toolbar id="editPersonToBar">
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk" id="saveEditPerBtn"
							update=":leftForm:tree :btnForm:btnBar  :btnForm:msgs :rightForm"
							oncomplete="PF('editUserDialog').hide()"
							disabled="#{!organizationPermissionController4Nw.checkStatus}"
							actionListener="#{organizationPermissionController4Nw.savePerson()}" />
						<p:commandButton icon="ui-icon-cancel" value="取消" type="button"
							onclick="PF('editUserDialog').hide()" style="margin-left:5px" />
					</f:facet>
				</p:toolbar>
				<p:messages id="messages3" showDetail="true" autoUpdate="true" closable="true" />
				<p:message for="newName" display="text" />
				<p:panelGrid id="editInfopg" columns="2" cellpadding="4" style="width:100%;text-align:center">
					<h:outputText value="用户名:" />
					<p:inputText disabled="true" value="#{organizationPermissionController4Nw.currentPerson.code}" />
					<h:outputText value="姓名:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.name}" id="newName">
						<p:ajax event="blur" update="editform:saveEditPerBtn"
							listener="#{organizationPermissionController4Nw.valdateEditPerson(organizationPermissionController4Nw.currentPerson)}" />
					</p:inputText>
					<h:outputText value="所属部门:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.group.name}" id="ownGroup"
						onclick="PF('deptDialog').show()" />
					<h:outputText value="电话:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.telephone}" />
					<h:outputText value="序号:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.orderNo}" />
					<h:outputText value="地址:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.address}" />
					<h:outputText value="角色:" />
					<p:selectManyCheckbox id="roles" value="#{organizationPermissionController4Nw.selectedRoles}"
						layout="grid" columns="3">
						<f:selectItems value="#{organizationPermissionController4Nw.roles}" var="r" itemLabel="#{r.name}"
							itemValue="#{r.id}" />
					</p:selectManyCheckbox>
				</p:panelGrid>
			</h:form>
		</p:dialog>
		<!-- 选择部门dialog框 -->
		<p:dialog widgetVar="deptDialog" header="选择新的部门" closable="false" resizable="false"
			draggable="false" modal="true" width="450" height="600">
			<h:form id="changeDeptform">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="确定" icon="ui-icon-disk" oncomplete="PF('deptDialog').hide()"
							update="editform:ownGroup" actionListener="#{organizationPermissionController4Nw.changeDept()}" />
						<p:commandButton icon="ui-icon-cancel" value="关闭" type="button"
							onclick="PF('deptDialog').hide()" style="margin-left:5px" />
					</f:facet>
				</p:toolbar>
				<p:tree value="#{organizationPermissionController4Nw.deptRoot}" var="node" dynamic="true"
					selectionMode="single" id="deptTree" widgetVar="deptTree" animate="true" style="border:0">
					<p:ajax event="expand" update="deptTree"
						listener="#{organizationPermissionController4Nw.onDeptNodeExpand}" />
					<p:ajax event="select" listener="#{organizationPermissionController4Nw.onDeptNodeSelect}" />
					<p:treeNode type="dept" icon="fa fa-home">
						<h:outputText value="#{node}" />
					</p:treeNode>
					<p:treeNode type="default" icon="fa fa-home">
						<h:outputText value="#{node}" />
					</p:treeNode>
				</p:tree>
			</h:form>
		</p:dialog>
		<!-- 新建/编辑部门dialog框 -->
		<p:dialog widgetVar="createDeptDialog" id="createDeptDialog" header="部门信息" closable="false"
			resizable="false" draggable="false" modal="true" width="350" height="350">
			<h:form id="cgform">
				<p:toolbar id="createDeptToBar">
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk" id="saveDeptBtn"
							update=":leftForm:tree :btnForm:btnBar :btnForm:msgs :rightForm"
							oncomplete="PF('createDeptDialog').hide()"
							actionListener="#{organizationPermissionController4Nw.saveDept()}"
							disabled="#{!organizationPermissionController4Nw.checkStatus}" style="margin-left:10px" />
						<p:commandButton icon="ui-icon-cancel" value="取消" type="button"
							onclick="PF('createDeptDialog').hide()" />
					</f:facet>
				</p:toolbar>
				<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
				<p:message for="deptName" display="text" />
				<p:panelGrid id="deptInfopg" columns="2" cellpadding="4" style="width:100%;text-align:center">
					<h:outputText value="部门名称:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentDept.name}" id="deptName">
						<p:ajax event="blur" update="cgform:saveDeptBtn"
							listener="#{organizationPermissionController4Nw.valdateDept(organizationPermissionController4Nw.currentDept)}" />
					</p:inputText>
					<h:outputText value="负责人:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentDept.principal}" />
					<h:outputText value="电话:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentDept.telephone}" />
					<h:outputText value="类型:" />
					<p:selectOneMenu value="#{organizationPermissionController4Nw.deptType}" style="width:80%">
						<f:selectItem itemLabel="" itemValue="" />
						<f:selectItems value="#{organizationPermissionController4Nw.allDeptType}" />
						<!-- <f:selectItem itemLabel="#{ManagementUnitEnum.DESORG.name}" itemValue="#{ManagementUnitEnum.DESORG.getType()}" />
						<f:selectItem itemLabel="#{ManagementUnitEnum.SUBCOMPANY.name}" itemValue="#{ManagementUnitEnum.SUBCOMPANY.getType()}" />
						<f:selectItem itemLabel="#{ManagementUnitEnum.ENTERPISE.name}" itemValue="#{ManagementUnitEnum.ENTERPISE.getType()}" /> -->
					</p:selectOneMenu>
					<h:outputText value="序号:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentDept.sno}" id="deptNo" />
				</p:panelGrid>
			</h:form>
		</p:dialog>
		<!-- 新建员工dialog框 -->
		<p:dialog widgetVar="createUserDialog" header="新建员工信息" closable="false" resizable="true"
			draggable="false" modal="true" width="400" height="380">
			<h:form id="crform">
				<p:toolbar id="createPersonToBar">
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk" id="savePerBtn"
							update=":leftForm:tree :btnForm:btnBar  :btnForm:msgs :rightForm"
							oncomplete="PF('createUserDialog').hide()"
							actionListener="#{organizationPermissionController4Nw.savePerson()}"
							disabled="#{!organizationPermissionController4Nw.checkStatus}" />
						<p:commandButton icon="ui-icon-cancel" value="取消" type="button"
							onclick="PF('createUserDialog').hide()" style="margin-left:5px" />
					</f:facet>
				</p:toolbar>
				<p:messages id="messages2" showDetail="true" autoUpdate="true" closable="true" />
				<p:message for="name" display="text" />
				<p:message for="code" display="text" />
				<p:panelGrid id="personnelInfopg" columns="2" cellpadding="4"
					style="width:100%;text-align:center">
					<h:outputText value="用户名:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.code}" id="code">
						<p:ajax event="blur" update="crform:savePerBtn"
							listener="#{organizationPermissionController4Nw.valdatePerson(organizationPermissionController4Nw.currentPerson)}" />
					</p:inputText>
					<h:outputText value="姓名:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.name}" id="name">
						<p:ajax event="blur" update="crform:savePerBtn"
							listener="#{organizationPermissionController4Nw.valdatePerson(organizationPermissionController4Nw.currentPerson)}" />
					</p:inputText>
					<h:outputText value="电话:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.telephone}" />
					<h:outputText value="序号:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.orderNo}" id="perNo" />
					<h:outputText value="地址:" />
					<p:inputText value="#{organizationPermissionController4Nw.currentPerson.address}" />
					<h:outputText value="角色:" />
					<p:selectManyCheckbox id="roles" value="#{organizationPermissionController4Nw.selectedRoles}"
						layout="grid" columns="3">
						<f:selectItems value="#{organizationPermissionController4Nw.roles}" var="r" itemLabel="#{r.name}"
							itemValue="#{r.id}" />
					</p:selectManyCheckbox>
					<h:outputText style="color:red" value="初始密码：" />
					<h:outputText style="color:red" value="#{organizationPermissionController4Nw.initPwd}" />
				</p:panelGrid>
			</h:form>
		</p:dialog>
	</ui:define>
	<ui:define name="contentend">
		<p:commandButton value="重置管理单位" id="resetStationLedgers" icon="ui-icon-trash"
			actionListener="#{organizationPermissionController4Nw.resetStationLedgers}" style="display: none;">
			<p:confirm header="提示" message="#{organizationPermissionController4Nw.updateMsg}"
				icon="ui-icon-alert" />
		</p:commandButton>
		<script>
			window.onload = function() {

			}
			//调用重置管理单位按钮
			function resetStationLedgers() {
				$("#resetStationLedgers").click();
			}
		</script>
	</ui:define>
</ui:composition>